package main

import "fmt"

type myMutex chan struct{}

func newMutex() myMutex {

	ch := make(chan struct{}, 1)
	return ch
}

func (m *myMutex) Lock() {

	*m <- struct{}{}
}

func (m *myMutex) UnLock() {
	<-*m
}
func main() {

	c := make(chan struct{})

	go func() {
		select {
		case <-c:
			fmt.Println("11")

		}
	}()
	c <- struct{}{}

	mutex := newMutex()
	mutex.Lock()
	defer mutex.UnLock()

}
